package com.cerosoft.api.exceptions;

/**
 * All apps can receive General and Reg/Auth errors and should be handled by a
 * general purpose error handler. Other errors listed here should be handled in
 * context by the app that is using associated functionality, e.g., Lending
 * errors should be handled by the Library app. If those errors are not handled
 * locally, the app should send this to our handler.
 * 
 */
public enum WebserviceError {
	// General
	UNEXPECTED, SERVER_ERROR,

	// Reg/Auth
	NOT_AUTHENTICATED, // Thrown when device needs to re-login with server. This
						// happens silently and api call retried.
	ACCOUNT_ISSUE_CALL_CUSTOMER_SERVICE, // Result of authenticate or register
	INVALID_PASSWORD, // Result of authenticate or register
	ACCOUNT_LOCKED, // Temporarily for 20 minutes
	EMAIL_NOT_ON_RECORD, // Result of authenticate or register
	INVALID_PASSWORD_LAST_CHANCE, // User has 6 chances to enter correct login
	NOT_REGISTERED, // No need to handle this locally yet

	// Future Auth errors
	MISSING_SERIAL_NUMBER, INVALID_SERIAL_NUMBER_FORMAT, INVALID_SERIAL_NUMBER, MISSING_PUBLIC_KEY, DEVICE_ALREADY_REGISTERED, DEVICE_BLACKLISTED_CALL_CUSTOMER_SERVICE, DEVICE_REQUIRES_REGISTRATION, DEVICE_REQUIRES_KEY_REGENERATION, DEVICE_UNAUTHORIZED, PUBLIC_PRIVATE_KEY_MISMATCH,

	// Account services
	INVALID_EMAIL_FORMAT, ACCOUNT_EXISTS, INVALID_PASSWORD_LENGTH, INVALID_SECURITY_QUESTION_ID, INVALID_SECURITY_QUESTION_ANSWER_LENGTH, INVALID_FIRST_NAME_LENGTH, INVALID_LAST_NAME_LENGTH, INVALID_CREDIT_CARD_NUMBER_FORMAT, INVALID_CREDIT_CARD_NUMBER_FOR_TYPE, INVALID_EXPIRATION_DATE, INVALID_SECURITY_CODE, MISSING_ADDRESS_PRIMARY_LINE, INVALID_CITY_LENGTH, MISSING_STATE, MISSING_POSTAL_CODE, INVALID_POSTAL_CODE_FORMAT, INVALID_PHONE_NUMBER_LENGTH, FAILED_ADDRESS_VALIDATION,

	// Purchase
	NO_DEFAULT_CREDIT_CARD, NO_DEFAULT_BILLING_ADDRESS, CREDIT_CARD_EXPIRED, INVALID_EAN, FRAUD_DETECTED, NOT_AVAILABLE_FOR_PURCHASE, ITEM_EXCEEDS_QUANTITY_LIMIT, // Not
																																									// applicable
																																									// for
																																									// Bravo
	ALREADY_PURCHASED, BILLING_ADDRESS_IS_INTERNATIONAL,

	// New
	NOT_AVAILABLE_ON_THIS_DEVICE, // publisher content control
	UNABLE_TO_INSERT_BOOK_INTO_DIGITAL_LOCKER_EDS_ERROR,

	// Store locator
	INVALID_STORE, INVALID_EVENT, INVALID_PHONE_NUMBER_FORMAT,

	// Wishlist
	ITEM_ALREADY_ON_LIST, // ignore
	LIST_LIMIT_REACHED, // Max 100
	ITEM_NOT_ON_LIST, // ignore
	FEATURE_ACCESS_SUSPENDED, // if banned

	// Instore Reading/Content
	CHUNK_NOT_IN_RANGE, EAN_NOT_STREAMABLE, EPUB_NOT_AVAILABLE, EPUB_PROCESSING_FAILED, INPUT_VALIDATION_ERROR, DUPLICATE_ITEM_EXISTS,

	// Curated content
	INVALID_CURATED_CONTENT_ID, // should never happen

	// Daily edition
	INVALID_FEED_URL,

	// Sample
	ALREADY_ADDED_SAMPLE,

	// Lending
	INVALID_LEND_INPUT, NOT_AVAILABLE_FOR_LOAN, NOT_PENDING, MAX_LOANS_REACHED, DUPLICATE_BORROWER_PURCHASED, DUPLICATE_BORROWER_BORROWED, RECIPIENT_EMAIL_BLOCKED, LEND_OFFER_EXPIRED,

	// Delivery / Download asset
	INVALID_DELIVERY_REQUEST_FORMAT, // should not happen
	INVALID_API_VERSION, // should not happen
	INVALID_DELIVERY_ITEM, // item not in locker
	PREORDER, // can't download yet
	FORMAT_ERROR, TRY_AGAIN, PAYMENT_ISSUE_CALL_CUSTOMER_SERVICE, TITLE_BLOCKED, CREDIT_CARD_HASH_ISSUE, // Need
																											// hash
																											// at
																											// download
	RESPONSE_REDIRECT,
	// Sync
	NO_SYNC_AUTHENTICATION_RESPONSE, // 

	// Download update
	INVALID_FILENAME, MISSING_FILE_OFFSET, INVALID_CHUNK_LENGTH, CHUNK_LENGTH_TOO_LARGE, OFFSET_TOO_LARGE,

	NEXT_FAILURE_WILL_LOCK_ACCOUNT
}